package com.atguigu.bigdata.scala.mytest.chapter07

import scala.collection.mutable

//无序不可重复
object Test_Set {
  def main(args: Array[String]): Unit = {
    //不可变
    val ints: Set[Int] = Set(1,2,3,4,4,56,6,6,6)
    println(ints)//Set(56, 1, 6, 2, 3, 4)

    val ints1: Set[Int] = ints + 11
    println(ints1)//Set(56, 1, 6, 2, 3, 11, 4)
    println(ints eq ints1)//false

    val ints2: Set[Int] = ints - 1
    println(ints2)//Set(56, 6, 2, 3, 4)

    //可变
    val ints3: mutable.Set[Int] = mutable.Set(1,3,5,6,6)
    println(ints3)//Set(1, 5, 6, 3)

    val tuples: mutable.Set[(Int, Int)] = ints3.zip(ints)
    println(tuples)//Set((5,1), (1,56), (6,6), (3,2))
  }

}
